<template>
  <div class="app-container">
    <el-container class="main-container">
      <el-header class="header">
        <div class="logo">
          <h1>SRS 服务器管理控制台</h1>
        </div>
      </el-header>
      
      <el-container class="content-container">
        <el-aside width="200px" class="aside">
          <el-menu
            :default-active="activePath"
            class="menu"
            router
            background-color="#f5f7fa"
            text-color="#606266"
            active-text-color="#1890ff"
          >
            <el-menu-item index="/">
              <el-icon><HomeFilled /></el-icon>
              <span>系统首页</span>
            </el-menu-item>
            <el-menu-item index="/streams">
              <el-icon><VideoPlay /></el-icon>
              <span>直播流管理</span>
            </el-menu-item>
            <el-menu-item index="/clients">
              <el-icon><User /></el-icon>
              <span>客户端管理</span>
            </el-menu-item>
            <el-menu-item index="/about">
              <el-icon><InfoFilled /></el-icon>
              <span>关于</span>
            </el-menu-item>
          </el-menu>
        </el-aside>
        
        <el-main class="main">
          <router-view v-slot="{ Component }">
            <transition name="fade" mode="out-in">
              <component :is="Component" />
            </transition>
          </router-view>
        </el-main>
      </el-container>
    </el-container>
  </div>
</template>

<script>
import { ref, computed, onMounted } from 'vue'
import { useRoute } from 'vue-router'
import { HomeFilled, VideoPlay, User, Document, InfoFilled } from '@element-plus/icons-vue'

export default {
  name: 'App',
  components: {
    HomeFilled,
    VideoPlay,
    User,
    Document,
    InfoFilled
  },
  setup() {
    const route = useRoute()
    
    // 计算当前激活的路径
    const activePath = computed(() => route.path)
    
    return {
      activePath
    }
  }
}
</script>

<style>
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', 'Helvetica Neue', Helvetica, Arial, sans-serif;
}

.app-container {
  height: 100vh;
  overflow: hidden;
}

.main-container {
  height: 100%;
  display: flex;
  flex-direction: column;
}

.content-container {
  flex: 1;
  display: flex;
  overflow: hidden;
}

.header {
  background-color: #fff;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  padding: 0 24px;
  display: flex;
  align-items: center;
  z-index: 100;
}

.logo h1 {
  font-size: 20px;
  font-weight: 600;
  color: #1890ff;
  margin: 0;
}

.aside {
  background-color: #f5f7fa;
  overflow: hidden;
}

.menu {
  border-right: none;
  height: 100%;
}

.main {
  background-color: #f0f2f5;
  padding: 24px;
  overflow-y: auto;
  flex: 1;
  min-height: 0;
}

/* 过渡动画 */
.fade-enter-active,
.fade-leave-active {
  transition: opacity 0.3s ease;
}

.fade-enter-from,
.fade-leave-to {
  opacity: 0;
}
</style>